import Koa from 'koa'
import dbConnection from './utils/db'
import { serverPort } from './config/app'
import { middleware } from './middleware'
const app: Koa = new Koa()

dbConnection
  .then(() => {
    middleware(app)

    app.listen(serverPort, () => {
      console.log(`server start on ${serverPort} successfully`)
    })
  })
  .catch((error: string) => console.log('TypeORM connection error: ', error))
